/**
 * @File Module.java
 * Date			Author		Changes
 * -------		--------	--------
 * Jul 15, 2011		Vijay Rajan		Created
 * 
 **/
package com.vh.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.appfuse.model.BaseObject;

/**
 * @author Vijay Rajan
 *
 */
@Entity
public class Module extends BaseObject implements Comparable<Module> {

	Long moduleId;
	String moduleName;
	Long parentId;
	
	
	
	@Override
	public String toString() {
		return new ToStringBuilder(this).append("moduleId", moduleId)
				.append("moduleName", moduleName).append("parentId", parentId)
				.toString();
	}



	@Override
	public boolean equals(final Object other) {
		if (!(other instanceof Module))
			return false;
		Module castOther = (Module) other;
		return new EqualsBuilder().append(moduleId, castOther.moduleId)
				.append(moduleName, castOther.moduleName)
				.append(parentId, castOther.parentId).isEquals();
	}



	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(moduleId).append(moduleName)
				.append(parentId).toHashCode();
	}



	public int compareTo(final Module other) {
		return new CompareToBuilder().append(moduleId, other.moduleId)
				.append(moduleName, other.moduleName)
				.append(parentId, other.parentId).toComparison();
	}



	/**
	 * Usage description: 
	 * 
	 * @see	com.celtic.cmvs
	 * @version 1.0 Jul 15, 2011
	 * @author Vijay Rajan
	 *
	 * @return the moduleId
	 */
	@Id @GeneratedValue(strategy = GenerationType.AUTO)
	public Long getModuleId() {
		return moduleId;
	}



	/**
	 * Usage description: 
	 * 
	 * @see	com.celtic.cmvs
	 * @version 1.0 Jul 15, 2011
	 * @author Vijay Rajan
	 *
	 * @param moduleId the moduleId to set
	 */
	public void setModuleId(Long moduleId) {
		this.moduleId = moduleId;
	}



	/**
	 * Usage description: 
	 * 
	 * @see	com.celtic.cmvs
	 * @version 1.0 Jul 15, 2011
	 * @author Vijay Rajan
	 *
	 * @return the moduleName
	 */
	@Column(length=50)
	public String getModuleName() {
		return moduleName;
	}



	/**
	 * Usage description: 
	 * 
	 * @see	com.celtic.cmvs
	 * @version 1.0 Jul 15, 2011
	 * @author Vijay Rajan
	 *
	 * @param moduleName the moduleName to set
	 */
	public void setModuleName(String moduleName) {
		this.moduleName = moduleName;
	}



	/**
	 * Usage description: 
	 * 
	 * @see	com.celtic.cmvs
	 * @version 1.0 Jul 15, 2011
	 * @author Vijay Rajan
	 *
	 * @return the parentId
	 */
	@Column
	public Long getParentId() {
		return parentId;
	}



	/**
	 * Usage description: 
	 * 
	 * @see	com.celtic.cmvs
	 * @version 1.0 Jul 15, 2011
	 * @author Vijay Rajan
	 *
	 * @param parentId the parentId to set
	 */
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}
	
	
	

}
